package com.kecheng.action;

import java.util.List;

import com.kecheng.dao.TeamDao;
import com.kecheng.dao.YongjinDao;
import com.kecheng.pojo.Team;
import com.kecheng.pojo.Yongjin;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.AllowedMethods;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;

@Action(value = "yongjin", results = {
		@Result(name = "fxyongjins", location = "/admin/seller/fxyongjin.jsp"),
})
@AllowedMethods(value = {("regex:.*")})
public class YongjinAction extends BaseAction{
	
	private Yongjin yongjin;
	@Autowired
	private YongjinDao yongjinDao;
	private String sid;
	private List<Yongjin> yongjins;
	private Team team;
	@Autowired
	private TeamDao teamDao;
	
	
	public String findall(){
		String sellerid=(String) session.get("openId");
		team=teamDao.findbysellerid(sellerid);
		try{
		yongjins=yongjinDao.findall(team.getId());
		}catch(Exception e){
			e.printStackTrace();
		}
		return "yongjins";
	}
	
	
	public String findbysid(){
		
	
		
		yongjins=yongjinDao.findall(team.getId());
	
		return "fxyongjins";
	}
	
	public Yongjin getYongjin() {
		return yongjin;
	}
	public void setYongjin(Yongjin yongjin) {
		this.yongjin = yongjin;
	}

	public String getSid() {
		return sid;
	}
	public void setSid(String sid) {
		this.sid = sid;
	}
	public List<Yongjin> getYongjins() {
		return yongjins;
	}
	public void setYongjins(List<Yongjin> yongjins) {
		this.yongjins = yongjins;
	}


	@Override
	public Team getTeam() {
		return team;
	}


	@Override
	public void setTeam(Team team) {
		this.team = team;
	}
}
